import React from 'react';
import { useNode } from '@craftjs/core';
import settings from './settings';
import styles from './index.less';

const displayName = '页面';

const PageContainer = ({ children, ...props }) => {
  const {
    connectors: { connect },
  } = useNode();

  return (
    <div {...props} ref={connect} className={`${styles.pageContainer} ${children ? null : styles.pageContainerEmpty}`}>
      {children}
    </div>
  );
};

PageContainer.craft = {
  displayName,
  props: {},
  related: {
    settings,
  },
};

export default PageContainer;
